package com.pw.study.flink.function

import com.pw.study.flink.entities.WordBeanOne
import org.apache.flink.api.common.functions.RichMapFunction
import org.apache.flink.configuration.Configuration

/**
 * @Desc: TODO
 * @author: future
 * @since: 2022/5/14-23:18
 */
class CustomRichMapFunction extends RichMapFunction[String,WordBeanOne]{
  override def map(in: String): WordBeanOne = {
    WordBeanOne(in,1L)
  }

  override def open(parameters: Configuration): Unit = {
    println("open.........")
    val subtask: Int = this.getRuntimeContext.getIndexOfThisSubtask
    println("subtask:"+subtask)
  }

  override def close(): Unit = {
    println("close.....")

  }
}
